﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IniParser;

namespace ChatBuddy.Classes.Helpers
{
    class SettingsHelper
    {
        public bool AutomaticUpdates { get; set; }
        public bool Balloons { get; set; }
        public bool Email { get; set; }
        public bool Wsvc { get; set; }
        public bool AudioWhisper { get; set; }
        public bool AudioName { get; set; }
        public bool AudioGm { get; set; }
        public bool ResponseFriends { get; set; }
        public bool ResponseGuild { get; set; }
        public bool ResponseWhisper { get; set; }
        public int IgnoreLimit { get; set; }
        public bool HardIgnore { get; set; }
        public bool BotheredNotification { get; set; }
        public bool RespondGm { get; set; }
        public bool UseHearthstone { get; set; }

        public void Initialize()
        {
            try
            {
                var dataParser = new FileIniDataParser();
                var parser =
                    dataParser.ReadFile(Path.Combine(Application.StartupPath,
                        @"plugins\ChatBuddy\bin\Settings\chatbuddy.ini"));

                AutomaticUpdates = true;
                Balloons = Convert.ToBoolean(parser["General"]["Balloons"]);
                Email = Convert.ToBoolean(parser["General"]["Email"]);
                Wsvc = Convert.ToBoolean(parser["General"]["WSVC"]);
                AudioWhisper = Convert.ToBoolean(parser["Audio"]["whisper"]);
                AudioName = Convert.ToBoolean(parser["Audio"]["name"]);
                AudioGm = Convert.ToBoolean(parser["Audio"]["GM"]);
                ResponseFriends = Convert.ToBoolean(parser["Response"]["friends"]);
                ResponseGuild = Convert.ToBoolean(parser["Response"]["guild"]);
                RespondGm = Convert.ToBoolean(parser["Response"]["gm"]);
                UseHearthstone = Convert.ToBoolean(parser["GM"]["Hearth"]);
                IgnoreLimit = Convert.ToInt32(parser["MHandle"]["Ignore"]);
                HardIgnore = Convert.ToBoolean(parser["MHandle"]["Hard"]);
                BotheredNotification = Convert.ToBoolean(parser["MHandle"]["Notification"]);
            }
            catch (Exception er)
            {
                MessageBox.Show("Foul: " + er.ToString());
            }
        }
    }
}
